How to display one column in another (layout DXL)?

I thought the code below would work to display the contents of one (non-main) column (which is in fact a layout DXL column) in another (layout DXL) column.
But it does not work: this layout DXL code leaves the column blank.

Yet if I change the code to run it as a regular script on the current object (not layout DXL)
(i.e. change "obj" in first line to "current", and change "display" in last line to "print"), then it DOES work: it prints the contents of the wanted column as a text string.

Is it not possible for one layout dxl column to look up the value in another layout dxl column?

Regards, Strathglass

Object o=obj
string dispTxt=""
string colTxt
string wantedColumn="DERIVED HEADING"
Column c
for c in current Module do
{
if (title(c) == wantedColumn)
{
break
}
else
{
c = null
}
}
if (!(null c))
{
colTxt=text(c, o)
dispTxt=colTxt
}
display dispTxt
strathglass - Wed Apr 22 14:47:44 EDT 2009

Re: How to display one column in another (layout DXL)?
llandale - Wed Apr 22 16:03:23 EDT 2009

Very interesting. The following works when I point it to a column displaying a regular attribute when run from the DXL window and also when run as a Layout. If I make that 1st layout column title 'Layout' and make a new layout column 'Layout 2nd' pointing to 'Layout', then it doesn't work. But if I then run the code again from the DXL window, I get printed two copies of the text.

It may have something to do with the refreshing of the Layout; I've done some tests which resulted in an alarming re-execution of Layout code simply when you select a new object. There is also the issue of this: which Layout executes first, the 'source' or the one that extracting from the source?

>Louie
 

Object o
if (null obj) //-
then o = current
else o = obj
 
string dispTxt=""
string colTxt
string wantedColumn="Layout 2nd"
Column c
for c in current Module do 
{
   if (title(c) == wantedColumn) 
   {
      break
   }
   else 
   {
      c = null
   }
}
if (!(null c))
   {
   colTxt=text(c, o)
   dispTxt=colTxt
}
if (null obj)    //-
then {print "Null obj: [[" dispTxt "]]\n"}
else display dispTxt